package com.sskj.spk.ui.activity;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Build;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.ImageView;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import com.lzy.okgo.utils.EncryptUtils;
import com.sskj.common.util.ImageUtil;
import com.sskj.common.util.RxSchedulersHelper;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.spk.R;
import com.sskj.spk.utils.RsaUtil;

import org.google.binary.Base64;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

import butterknife.BindView;
import butterknife.ButterKnife;
import io.reactivex.Flowable;

public class SplashActivity extends Activity {
    @BindView(R.id.ivBg)
    ImageView ivBg;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setNavigationBarColor();
        setContentView(R.layout.app_activity_splash);
        ButterKnife.bind(this);
        ImageUtil.setOriginImage(R.mipmap.app_splash, ivBg);
        Flowable.timer(3, TimeUnit.SECONDS).compose(RxSchedulersHelper.transformer()).subscribe(aLong -> {
            Intent intent = new Intent(SplashActivity.this, MainActivity.class);
            startActivity(intent);
            finish();
        });
    }


    private void setNavigationBarColor() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            // Translucent navigation bar
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        }
    }

}
